<!--
 * @Author: your name
 * @Date: 2021-12-03 11:10:14
 * @LastEditTime : 2022-04-21 17:09:45
 * @LastEditors  : Shiming
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath     : \\tms-obc-web\\src\\app\\routes\\waybill-management\\components\\vehicle\\vehicle.component.html
-->
<!-- 搜索表单 -->
<!-- <page-header-wrapper [title]="''"> </page-header-wrapper>
<nz-card>
  <div nz-row nzGutter="8">
    <ng-container *ngIf="queryFieldCount > 4">
      <div nz-col [nzSpan]="_$expand ? 24 : 18">
        <sf #sf [schema]="schema" [ui]="ui" [compact]="true" [button]="'none'"></sf>
      </div>
      <div nz-col [nzSpan]="_$expand ? 24 : 6" class="text-right">
        <button nz-button nzType="primary" [nzLoading]="service.http.loading" (click)="search()" acl
          [acl-ability]="['WAYBILL-VEHICLE-search']">查询</button>
        <button nz-button nzType="primary" [disabled]="false" acl [acl-ability]="['WAYBILL-VEHICLE-export']"
          (click)="exprot()">导出</button>
        <button nz-button [disabled]="false" (click)="resetSF()">重置</button>
        <button nz-button nzType="link" (click)="expandToggle()">
          {{ !_$expand ? '展开' : '收起' }}
          <i nz-icon [nzType]="!_$expand ? 'down' : 'up'"></i>
        </button>
      </div>
    </ng-container>
  </div>
</nz-card> -->

<nz-card class="table-box">
  <div class="tab_header">
    <label class="page_title"> <label class="driver">|</label> 整车运单</label>
    <nz-tabset (nzSelectedIndexChange)="selectChange($event)" [nzTabBarExtraContent]="extraTemplate">
      <nz-tab [nzTitle]="'全部(' + tabs?.totalQuantity + ')'"></nz-tab>
      <nz-tab [nzTitle]="'待接单(' + tabs?.stayQuantity + ')'"></nz-tab>
      <nz-tab [nzTitle]="'待发车(' + tabs?.receivedQuantity + ')'"></nz-tab>
      <nz-tab [nzTitle]="'运输中(' + tabs?.cancelQuantity + ')'"></nz-tab>
      <nz-tab [nzTitle]="'待签收(' + tabs?.signQuantity + ')'"></nz-tab>
      <nz-tab [nzTitle]="'已完成(' + tabs?.compolatelQuantity + ')'"></nz-tab>
      <nz-tab [nzTitle]="'已取消(' + tabs?.deltQuantity + ')'"></nz-tab>
    </nz-tabset>
  </div>
  <div>
    <st
      #st
      [bordered]="true"
      [scroll]="{ x: '2000px', y: scrollY }"
      [data]="service.$api_get_wholePage"
      [columns]="columns"
      [req]="{ method: 'POST', allInBody: true, reName: { pi: 'pageIndex', ps: 'pageSize' }, params: reqParams }"
      [res]="{ reName: { list: 'data.records', total: 'data.total' } }"
      [page]="{ show: true, showSize: true, pageSizes: [10, 20, 30, 50, 100, 200, 300, 500, 1000] }"
      [loading]="false"
    >
      <ng-template st-row="createUserName" let-item let-index="index">
        <div> {{ item?.createUserName }}/{{ item?.createUserPhone }} </div>
      </ng-template>
      <ng-template st-row="createUserName" let-item let-index="index">
        <div> {{ item?.createUserName }}/{{ item?.createUserPhone }} </div>
      </ng-template>
      <ng-template st-row="driverName" let-item let-index="index">
        <div> {{ item?.driverName }}/{{ item?.driverTelephone }}/{{ item?.driverLicenseCarNo }} </div>
      </ng-template>
      <ng-template st-row="payeeName" let-item let-index="index">
        <div> {{ item?.payeeName }}/{{ item?.payeePhone }} </div>
      </ng-template>
      <ng-template st-row="billExpenseDetailVOList2" let-item let-index="index">
        <div *ngIf="item?.mybidInfo?.length > 0">
          <p *ngFor="let data of item?.mybidInfo"> {{ data?.expenseName }}：{{ data?.price | currency }} </p>
        </div>
      </ng-template>
      <ng-template st-row="billExpenseDetailVOList" let-item let-index="index">
        <div *ngIf="item?.billExpenseDetails?.length > 0">
          <p *ngFor="let data of item?.billExpenseDetails">
            {{ data?.costName }}：{{ data?.price | currency }}
            <span style="color: #f59a63">{{ data?.paymentStatusLabel }}</span>
          </p>
        </div>
      </ng-template>
      <ng-template st-row="wayBillCode" let-item let-index="index">
        <a [routerLink]="'vehicle-detail/' + item?.id">{{ item?.wayBillCode }}</a>
        <div>
          <span>{{ item?.wayBillStatusLabel }}</span>
        </div>
        <div>
          <span>{{ item?.billSourceLabel }}</span>
        </div>
      </ng-template>
      <ng-template st-row="wayBill" let-item let-index="index">
        <a [routerLink]="'/vehicle-detail/' + item?.id">{{ item?.billCode }}</a>
      </ng-template>
      <ng-template st-row="goodsInfos" let-item let-index="index">
        <div>{{ item?.goodsInfos?.goodsName }}</div>
        <div
          >{{ item?.goodsInfos?.weight }}{{ item?.goodsInfos?.volume ? '/' + item?.goodsInfos?.volume : ''
          }}{{ item?.goodsInfos?.number ? '/' + item?.goodsInfos?.number : '' }}</div
        >
      </ng-template>
      <ng-template st-row="loadingTime" let-item let-index="index">
        <div *ngIf="item?.loadingTime">装 | {{ item?.loadingTime }}</div>
        <div *ngIf="item?.unloadingTime">卸 | {{ item?.unloadingTime }}</div>
      </ng-template>
    </st>
  </div>
</nz-card>

<ng-template #extraTemplate>
  <div class="mr-sm">
    <button nz-button nzDanger [nzLoading]="service.http.loading" (click)="openDrawer()" acl [acl-ability]="['WAYBILL-VEHICLE-search']"
      >筛选</button
    >
    <button nz-button nzDanger acl [acl-ability]="['WAYBILL-VEHICLE-export']" (click)="exprot()">导出</button>
  </div>
</ng-template>
